import { http } from "@/utils/http";

/** 金融商品列表 */
export const getProducts = (data?: any) => {
  return http.request("post", "/admin/finance/goods/list", { data });
};

/** 金融商品详情 */
export const getProductInfo = (fgId: number) => {
  return http.request("post", "/admin/finance/goods/info", { data: { fgId } });
};

/** 设置商品详情 */
export const setProductInfo = (data?: any) => {
  return http.request("post", "/admin/finance/goods/set", { data });
};

/** 添加商品详情 */
export const addProductInfo = (data?: any) => {
  return http.request("post", "/admin/finance/goods/add", { data });
};

/** 金融订单列表 */
export const getFinanceOrders = (data?: any) => {
  return http.request("post", "/admin/finance/order/list", { data });
};

/** 设置订单 */
export const setProductOrder = (data?: any) => {
  return http.request("post", "/admin/finance/order/set", { data });
};

/** 金融商订单详情 */
export const getOrderInfo = (orderId: number, type: number) => {
  return http.request("post", "/admin/finance/order/info", {
    data: { orderId, type }
  });
};

/** 根据类型状态查询金融商品列表 type- 1,3,4
 * status "状态:0=下架,1=上架,2:预售;-1全部"
 *
 */
export const getProductsByType = (data?: any) => {
  return http.request("post", "/admin/finance/goods/type", { data });
};
/** 添加金融商订单 */
export const addOrder = (data?: any) => {
  return http.request("post", "/admin/finance/order/add", { data });
};
/**
 *获取发货详情
 * @param orderId
 * @returns
 */
export const getShipInfo = (orderId: number) => {
  return http.request("post", "/admin/finance/ship/info", {
    data: { orderId }
  });
};
/** 订单发货
 * "shipId": "required|integer", //金融产品类型
    "address": "string", //金融产品类型
    "name": "string", //金融产品类型
    "lxfs": "string", //金融产品类型
    "shipStatus": "integer:0,1,2", //金融产品类型
    "shipCompany": "string", //金融产品类型
    "shipNo": "string", //金融产品类型
    "shipImage": "string"
 */
export const toSendShip = (data?: any) => {
  return http.request("post", "/admin/finance/ship/send", { data });
};
/**
 * 发货列表
 */
export const getShipList = (data?: any) => {
  return http.request("post", "/admin/finance/ship/list", { data });
};
